<?python
  
    from fasttrack.utils import fmt, textilize, getGroups
    from turbogears import identity
    from fasttrack.widgets import AnswersWidget
    
    user_person = identity.current.user
    groupids = getGroups();
    
?>

<li xmlns:py="http://purl.org/kid/ns#" class="question" id="question_$question.id">
	<div class="question_content" onmouseover="show_inline('add_answer_link_$question.id');show_inline('remove_question_link_$question.id');" onmouseout="hide('add_answer_link_$question.id');hide('remove_question_link_$question.id');">
		${XML(textilize(question.question))}
		<div class="question_info">
			<span>Asked by <a href="mailto:$question.creator.emailAddress">${question.creator.displayName}</a>
			on ${fmt(question.creation_date)}</span>
			<a py:if="not read_only" class="add_answer_link" id="add_answer_link_$question.id" style="display: none;" href="#" onclick="toggle('add_answer_$question.id'); fcs('new_answer_text_$question.id'); return false;">add answer</a>
			<a py:if="not read_only and (user_person == question.creator or 'admin' in groupids)" class="remove_question_link" id="remove_question_link_$question.id" style="display: none;" href="#" onclick="remove_question($question.id); return false;">remove</a>
		</div>
	</div>
	
	<div py:if="not read_only" class="new_answer" id="add_answer_$question.id" style="display: none;">
		<b>Answer</b><br/>
		<textarea id="new_answer_text_$question.id" name="answer" rows="5" cols="80"></textarea><br/>
		<a href="#" onclick="add_answer($question.id); return false;">add</a>
		<a href="#" onclick="toggle('add_answer_$question.id'); return false;">cancel</a>
	</div>
	
    <span py:replace="AnswersWidget(answers=question.answers, question_id=question.id, read_only=read_only).display()" />
</li>